//
// Created by Tony on 2024/6/19.
//

#ifndef RUNTIME_IF_NE_H
#define RUNTIME_IF_NE_H

#include "Instruction.h"

namespace Runtime {

class IF_FALSE : public BranchInstruction {

public:
    IF_FALSE() : BranchInstruction(__func__, OpCode::IF_FALSE) {}

    void execute(RtData::Frame& frame) override {
        auto val = frame.popValue();
        if (val.value.int64 == 0) {
            frame.setNextPC(frame.getNextPC() + mOffset - INSTR_LEN);
        }
    }
};

} // namespace Runtime

#endif // RUNTIME_IF_NE_H